// pages/index/yuyue/yuyue.js
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    show: false,
    show2:false,
    show3:false,
    date: '2025',
    zxsdj_id:'',
    zxsdj_title:"国家一级心里咨询师",
    zxlb_title:"亲子关系",
    zxsdj:[
      {id:1,name:"国家一级心里咨询师"},
      {id:2,name:"国家二级心里咨询师"},
      {id:3,name:"国家三级心里咨询师"}],
    zxlb:[
      {type:"default",name:"家庭关系"},
      {type:"default",name:"亲子关系"},
      {type:"default",name:"婚恋感情"},
      {type:"default",name:"生活问题"},
      {type:"default",name:"个体咨询"},
      {type:"default",name:"人际关系"}
    ],
    FindList:[],
    url:'',
    losthost:'',
    selectedLevelIndex: null,
  },
    // 点击事件处理
    handleItemTap(e) {
      const { index, item } = e.currentTarget.dataset;
      console.log('点击的索引:', index);
      console.log('点击的项:', item);
      console.log(e.currentTarget.dataset.item.name);
      console.log(e);
      
      // 可以在这里更新数据
      this.setData({
        zxsdj_title:item.name,
        zxsdj_id:item.id,
        show:false
      });
      console.log(this.data.zxsdj_id);

    },
zxlbClick(e){
  const { index, item }=e.currentTarget.dataset;
  console.log(e.currentTarget.dataset);
  const newType = this.data.zxlb[index].type === "default" ? "info" : "default";
  this.setData({
    zxlb_title: item.name,
    [`zxlb[${index}].type`]: newType,
    show2: false
  });
  

},
onClickLeft:function(){
  wx.navigateBack()
},
onClick1(){
  this.setData({ show: true });

},
onClose1() {
  this.setData({ show: false });
},
onClick2(){
  this.setData({ show2: true });

},
onClose2() {
  this.setData({ show2: false });
},
onClick3(){
  this.setData({ show3: true });

},
onClose3() {
  this.setData({ show3: false });
},
formatDate(date) {
  date = new Date(date);
  return `${date.getMonth() + 1}/${date.getDate()}`;
},
onConfirm(event) {
  this.setData({
    show3: false,
    date: this.formatDate(event.detail),
  });
},

  // Vant输入框事件
  onVanFocus() {
    console.log('Vant键盘已弹出');
    this.setData({ vanFocus: true });
  },
  
  onVanBlur() {
    console.log('Vant键盘已收起');
    this.setData({ vanFocus: false });
  },


// queding(){
//   wx.navigateTo({ url: "/pages/index/yuyue/zxyy/zxyy?" })
  
// },



onLoad() {
  const app = getApp();
      this.setData({
          url: app.globalData.URL,
          losthost:app.globalData.losthost
      })
      console.log(this.data.url)
      console.log(this.data.losthost)
      
},
queding: function(){
  wx.request({
    url: this.data.url+"wt/consultant/getAll",
    method:'GET',
    data:{
      levelId:this.data
    },
    success:(res)=>{
      console.log(e);
      console.log(1111);
      console.log("res",res.data.data)
      this.setData({
          FindList:res.data.data,
      })
      console.log("FindList",this.data.FindList)
    },
    fail:(err)=>{
        console.log(err)
    }
  })
},

})